<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="format-detection" content="telephone=no" />
    <meta name="format-detection" content="email=no" />
    <title>店铺详情</title>
    <link rel="stylesheet" href="../../css/api.css">
    <link rel="stylesheet" href="../../css/main.css">
    <style>
        html,
        body {
            background: #fff;
        }
    </style>
</head>

<body>
    <div class="app store-detail-frm" v-cloak>
        <div class="bgf plr wd-sjrz">
            <div class="yyzz-detail-item flex-x-sb">
                <div class="flex-x-s">
                    <div class="title">店铺名称</div>
                    <div class="content">{{shop.shopName}}</div>
                </div>
            </div>
            <div class="yyzz-detail-item flex-x-sb">
                <div class="flex-x-s">
                    <div class="title">店铺类型</div>
                    <div class="sex flex-x-s dp-detail-label" v-if="shop.shopType && shop.shopType.length > 0">
                        <div v-for="(item,index) in shop.shopType" :key="index">{{item}}</div>
                    </div>
                    <div class="sex flex-x-s dp-detail-label" v-else>-</div>
                </div>
            </div>
            <div class="yyzz-detail-item flex-x-sb">
                <div class="flex-x-s">
                    <div class="title">银行卡</div>
                    <div class="content">{{shop.bankCard}}</div>
                </div>
            </div>
            <div class="yyzz-detail-item flex-x-sb">
                <div class="flex-x-s">
                    <div class="title">开户行</div>
                    <div class="content">{{shop.openBank}}</div>
                </div>
            </div>
            <div class="yyzz-detail-item flex-x-sb">
                <div class="flex-x-s store-detail-tel" :key="index">
                    <div class="title">联系电话</div>
                    <div class="content">
                        {{shop.contactTels.join(',')}}
                    </div>
                </div>
            </div>
        </div>
        <div class="grzx-item flex-x-sb" @click="goPage('order')" v-if="onlineBuyEnabled">
            <div>我的出售订单</div>
            <div class="grzx-right">
                <div></div>
                <span class="iconfont">&#xe666;</span>
            </div>
        </div>
        <div class="grzx-item flex-x-sb" @click="goPage('balance',1)" v-if="onlineBuyEnabled">
            <div>余额</div>
            <div class="grzx-right">
                <div>{{(Number(shopBalance.withdrawing) + Number(shopBalance.unWithdraw)).toFixed(2)}}</div>
                <span class="iconfont">&#xe666;</span>
            </div>
        </div>
        <div class="grzx-item flex-x-sb" @click="goPage('balance',2)" v-if="onlineBuyEnabled">
            <div>在途资金</div>
            <div class="grzx-right">
                <div>{{Number(shopBalance.onTheWay).toFixed(2)}}</div>
                <span class="iconfont">&#xe666;</span>
            </div>
        </div>
        <div class="grzx-item flex-x-sb" @click="goPage('balance',3)" v-if="onlineBuyEnabled">
            <div>历史提现</div>
            <div class="grzx-right">
                <div>{{Number(shopBalance.history).toFixed(2)}}</div>
                <span class="iconfont">&#xe666;</span>
            </div>
        </div>
        <div class="dp-edit-intro" style="margin-bottom: .6rem;">
            <div class="title">店铺简介</div>
            <div class="content">{{shop.shopIntro}}</div>
        </div>
    </div>
    <script src="../../script/api.js"></script>
    <script src="../../script/flexible.js"></script>
    <script src="../../script/fastclick.js"></script>
    <script src="../../script/vue.min.js"></script>
    <script src="../../script/iconfont.js"></script>
    <script src="../../script/common.js"></script>
    <script src="../../script/restful.js"></script>
    <script src="../../script/businessCommon.js"></script>
    <script>
        apiready = function() {
            api.addEventListener({
                name: 'reflesh'
            }, function(ret, err) {
                vm.initStoreDetail();
            });
            vm = new Vue({
                el: '.app',
                data: {
                    shop: {
                        shopId: "",
                        shopName: "",
                        shopType: [],
                        bankCard: "",
                        openBank: "",
                        contactTels: [],
                        balance: "",
                        deposit: "",
                        withDraw: {},
                        shopIntro: ""
                    },
                    shopBalance: {
                        onTheWay: 0, //提现中金额
                        unWithdraw: 0, //未提现金额
                        withdrawing: 0, //提现中金额
                        history: 0 //历史提现
                    },
                    onlineBuyEnabled:false
                },
                created: function () {
                    this.initStoreDetail();
                    this.initStoreBalance();
                    this.getSystemSet()
                },
                mounted: function () {
                },
                methods: {
                    getSystemSet(){
                        var vm = this;
                        common('getSystemSet')({}, function (ret) {
                            console.log("系统设置：" + JSON.stringify(ret))
                            vm.onlineBuyEnabled = ret.data.onlineBuyEnabled
                        })
                    },
                    initStoreBalance() {
                        var vm = this;
                        mime("getUserShopBalance")(function(ret) {
                            vm.shopBalance = ret.data;
                        });
                    },
                    initStoreDetail() {
                        var vm = this;
                        mime("getUserShopInfo")(function(ret) {
                            vm.shop = ret.data;
                            api.sendEvent({
                                name: 'storeTranslate',
                                extra: {shop: vm.shop}
                            })
                        })
                    },
                    goPage(url, type) {
                        api.openWin({
                            name: `${url}_win`,
                            url: `${url}_win.html`,
                            bounces: false,
                            pageParam: {
                                type: type,
                                shopBalance: this.shopBalance
                            }
                        });
                    }
                },
            })
        }
    </script>
</body>

</html>
